type Fn = (a: number, b: string) => number

type AppendArgumentResult = AppendArgument<Fn, boolean>
// 期望是 (a: number, b: string, x: boolean) => number

type AppendArgument<
  F extends Function,
  B extends unknown> = F extends (...args: [...infer Args]) => infer RT
  ? (...args: [...Args, B]) => RT
  : F;